Added support for Arbitrary for fuzzing#14
Added support for Arbitrary for fuzzing#14LucaCappelletti94 wants to merge 3 commits intoisdaniel:mainfrom
Conversation
Summary of ChangesHello @LucaCappelletti94, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces comprehensive support for fuzz testing by integrating the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for fuzzing by implementing the Arbitrary trait for various protocol message types, which is a valuable addition for improving the robustness of the parsing logic. The changes are generally well-implemented. My review includes a few suggestions to make the code more maintainable and idiomatic by leveraging features from the arbitrary crate, such as its derive macro and choose method, which will simplify the code and make it less brittle to future changes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14 +/- ##
=======================================
Coverage ? 64.10%
=======================================
Files ? 8
Lines ? 4608
Branches ? 0
=======================================
Hits ? 2954
Misses ? 1654
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: isdaniel <9159452+isdaniel@users.noreply.github.com>
Co-authored-by: isdaniel <9159452+isdaniel@users.noreply.github.com>
Co-authored-by: isdaniel <9159452+isdaniel@users.noreply.github.com>
Co-authored-by: isdaniel <9159452+isdaniel@users.noreply.github.com>
Co-authored-by: isdaniel <9159452+isdaniel@users.noreply.github.com>
|
Hi @LucaCappelletti94 thank you for your PR, I didn't use arbitrary crate lib before, as I reviewed from https://github.com/rust-fuzz/arbitrary github readme and docs https://docs.rs/arbitrary/latest/arbitrary/, as my understanding it's generally intended to be used with random fuzzers structured. however, could you share more detail or used case that benefit for this lib that we really need that? so far, I haven't come up with any scenario where it would be necessary to provide a fuzzing API to the client. |
|
Basically, I wrote a crate for the SQLite patchset format, which I directly attach on top of a logical stream. My crate needs to be solid and able to handle any possible input of your crate without crashing, hence the fuzzer. Specifically, I use honggfuzz. |
|
Hi @LucaCappelletti94 can we use arbitrary combine pg-walstream crate instead of modified that internally? because I don't want to introduce any code which don't relate to PostgreSQL replication protocol implement in this lib. here is the example for Arbitrary for fuzzing #19 |
|
In my uses cases, I found that the simplest possible solution was:
Of course, this causes a MASSIVE amount of tests to be discarded, and that is what the structured Arbitrary impl should avoid. I will study a bit more in details the proposed impl and review it asap. |
Pretty straighforward PR adding an implementation of Arbitrary. I need it for fuzz random structured pgprotocols.